package java6681.sort.set;

import java.util.Comparator;

/**
 * @author Junichiro
 * @description 比较器类
 * @date 2021-04-08 12:43
 **/

public class SorterByCredit6681 implements Comparator<Course6681> {

    @Override
    public int compare(Course6681 o1, Course6681 o2) {
        int num = o1.getCredit() - o2.getCredit();
        int num2 = num == 0 ? o1.getName().compareTo(o2.getName()) : num;
        return num2;
    }
}
